{
  "properties" : { },
  "id" : "ff0a25fa1a84432783d52279ec88db9e",
  "script" : null,
  "groupId" : "fba8d4bd351f4b8f9bbbff87230b9af7",
  "name" : "全表",
  "createTime" : null,
  "updateTime" : 1673404105578,
  "lock" : null,
  "createBy" : null,
  "updateBy" : "admin",
  "path" : "/all",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import log;
var sql = """
"""
if (body.username != '' && body.groupname == null) {
    sql = """ select * from file_download_number where username = #{body.username} 
                     order by download_date desc,groupname desc,username desc,download_number desc"""
} else if (body.groupname != null && body.username == '') {
    sql = """ select * from file_download_number where groupname = #{body.groupname} 
                     order by download_date desc,groupname desc,username desc,download_number desc"""
} else if (body.username != '' && body.groupname != '') {
    sql = """ select * from file_download_number where groupname = #{body.groupname} 
                    and username = #{body.username}
                     order by download_date desc,groupname desc,username desc,download_number desc"""
} else {
    sql = """ select * from file_download_number 
                     order by download_date desc,groupname desc,username desc,download_number desc"""
}
return db.select(sql)